<template>
  <div class="side-nav" :class="{ expanded: isExpanded }">
    <div class="nav-content">
      <!-- Logo区域 -->
      <router-link to="/" class="nav-logo">
        <i class="fas fa-code"></i>
        <span class="nav-text">GUGUCode</span>
      </router-link>
      
      <!-- 导航项目 -->
      <router-link 
        v-for="item in navItems" 
        :key="item.id"
        :to="item.path"
        class="nav-item"
        :class="{ active: $route.path === item.path }"
      >
        <div class="nav-icon">
          <i :class="item.icon"></i>
        </div>
        <span class="nav-text">{{ item.text }}</span>
      </router-link>
      
      <!-- 测试页面 -->
      <router-link to="/test" class="nav-item" title="测试">
        <i class="fas fa-flask"></i>
      </router-link>
    </div>
  </div>
</template>

<script>
export default {
  name: 'SideNav',
  data() {
    return {
      isExpanded: false,
      navItems: [
        { id: 1, text: '首页', icon: 'fas fa-home', path: '/home' },
        { id: 2, text: '题库', icon: 'fas fa-code', path: '/problems' },
        { id: 3, text: '小组', icon: 'fas fa-users', path: '/groups' },
        { id: 4, text: 'AI助手', icon: 'fas fa-robot', path: '/ai-assistant' },
        { id: 5, text: '个人中心', icon: 'fas fa-user', path: '/profile' },
        { id: 6, text: '数据统计', icon: 'fas fa-chart-line', path: '/statistics' }
      ]
    }
  }
}
</script>

<style scoped>
.side-nav {
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  width: 60px;
  background: rgba(164, 208, 246, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-right: 1px solid rgba(255, 255, 255, 0.3);
  transition: all 0.3s ease;
  z-index: 1000;
}

.side-nav:hover {
  width: 200px;
}

.nav-content {
  padding: 20px 0;
  height: 100%;
}

/* Logo样式 */
.nav-logo {
  text-decoration: none;
  display: flex;
  align-items: center;
  padding: 0 20px 20px 20px;
  font-size: 20px;
  color: #2c3e50;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  margin-bottom: 10px;
}

.nav-logo i {
  min-width: 20px;
}

.nav-item {
  text-decoration: none;
  display: flex;
  align-items: center;
  padding: 15px 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  color: #2c3e50;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.3);
}

.nav-icon {
  min-width: 20px;
  display: flex;
  justify-content: center;
}

.nav-icon i {
  font-size: 16px;
}

.nav-text {
  margin-left: 15px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.side-nav:hover .nav-text {
  opacity: 1;
}

/* 深色模式下保持明亮风格 */
@media (prefers-color-scheme: dark) {
  .side-nav {
    background: rgba(164, 208, 246, 0.85);
  }
  
  .nav-item {
    color: #2c3e50;
  }
}

/* 添加激活状态样式 */
.nav-item.active {
  background: rgba(255, 255, 255, 0.3);
  position: relative;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 4px;
  background: #3498db;
  border-radius: 0 2px 2px 0;
}
</style> 